<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<p>第一个数:<input id="di" type="text" size="15"></input></p>
		<p>第二个数:<input id="er" type="text" size="15"></input></p>
		<button onclick="jisuan()"/>计算</button>
	</body>
</html>
<script>
	function jisuan(){
		var di = document.getElementById("di").value;
		var er = document.getElementById("er").value;
		if(di === '' || er === ''){
			alert("数据不能为空");
		}else{
			var sum = parseInt(di) + parseInt(er);
			document.writeln(parseInt(di)+"+"+parseInt(er)+"="+sum)
		}
	}
	
	
</script>